//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using EntLibContrib.Resource.Configuration.Unity;

namespace EntLibContrib.Resource.Configuration
{
	/// <summary>
	/// Configuration data defining ResourceManagerData. Defines the information needed to properly configure
	/// a ResourceManager instance.
	/// </summary>    	
	[Assembler(typeof(ResourceManagerAssembler))]
	[ContainerPolicyCreator(typeof(ResourceManagerPolicyCreator))]
	public class ResourceManagerData : ResourceManagerDataBase
	{
		#region Constants
		private const string resourceProviderNameProperty = "resourceProviderName";
		#endregion

		#region Properties
		/// <summary>
		/// ResourceProviderData object from configuration describing how data is stored 
		/// in the resource.
		/// </summary>
		[ConfigurationProperty(resourceProviderNameProperty, IsRequired = true)]
		public string ResourceProvider
		{
			get { return (string)base[resourceProviderNameProperty]; }
			set { base[resourceProviderNameProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initialize a new instance of the <see cref="ResourceManagerData"/> class.
		/// </summary>
		public ResourceManagerData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="ResourceManagerData"/> class.
		/// </summary>
		/// <param name="name">The name of the <see cref="ResourceManagerData"/>.</param>
		/// <param name="resourceProvider">ResourceProviderData object from configuration describing how data is stored
		/// in the resource.</param>
		public ResourceManagerData (string name, string resourceProvider) : base(name, typeof(ResourceManager))
		{
			this.ResourceProvider = resourceProvider;
		}
		#endregion
	}
}